package com.ironman.compute.generator;


import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.RandomUtil;
import lombok.RequiredArgsConstructor;
import org.noear.snack.ONode;
import org.springframework.stereotype.Component;

@Component
@RequiredArgsConstructor
public class VmgComputeDataGenerator extends ComputeDataGenerator {


    @Override
    public String topicType() {
        return "vmg";
    }

    @Override
    public ONode generate() {
        return ONode.newObject()
                .set("dueNorth", true)
                .set("sailStatus", "D_P")
                .set("posture", "倾斜")
                .set("postureType", "y")
                .set("angle", RandomUtil.randomInt(-180, 180))
                .set("vmg", NumberUtil.round(RandomUtil.randomDouble(100.0000, 200.9999), 4).doubleValue())
                .set("customVmg", NumberUtil.round(RandomUtil.randomDouble(100.0000, 200.9999), 4).doubleValue())
                .set("standardVmg", 120.12345)
                .set("windSourceBoatCode", "00")
                .set("windSpeed", 33.1234)
                .set("windDirection", 20)
                .set("customSpeed", 514.44)
                .set("customDirection", 100);
    }

}
